/**
 * 
 */
package com.google.code.sip.ucenter.dao.mongo;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.google.code.sip.core.dao.mongo.GenericMongoDao;
import com.google.code.sip.ucenter.dao.UserCustomProfileDao;
import com.google.code.sip.ucenter.model.User;
import com.google.code.sip.ucenter.model.UserCustomProfile;

/**
 * @author Liuye
 * 
 */

public class UserCustomProfileDaoImpl extends
		GenericMongoDao<UserCustomProfile, String> implements
		UserCustomProfileDao {
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.google.code.sip.ucenter.dao.mongo.UserCustomProfileDao#findByUser(com
	 * .google.code.ucenter.model.User)
	 */
	public List<UserCustomProfile> findByUser(User user) {
		Map<String, Object> filter = new LinkedHashMap<String, Object>();
		filter.put("user", user);
		return findByProperties(filter);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.google.code.sip.ucenter.dao.mongo.UserCustomProfileDao#get(com.google
	 * .code.ucenter.model.User, java.lang.String)
	 */
	public UserCustomProfile get(User user, String propName) {
		Map<String, Object> filter = new LinkedHashMap<String, Object>();
		filter.put("user", user);
		filter.put("name", propName);
		return getByProperties(filter);
	}
}
